Skip to content

Fork: assistant setup (switch, built-in assistant profile, Make assistant) - #953

Merged
scuttletoby merged 7 commits into
mainfrom
fork/assistant-setup
Nov 22, 2026
Merged

scuttletoby merged 7 commits into
mainfrom
fork/assistant-setup

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Assistant PR 2 of 18 (#879). Builds on #927 (builtinTools: "none") and #928 (threadRoles).

What and why

The assistant is one long thread you talk to across projects. This PR lets you set it up. It is off by default.

  • Settings block assistant (server, person-only, whole-managed). assistant.enabled is off by default. When it is off, Settings shows no Make assistant button. A bad or missing value reads as off.

  • Built-in MCP profile assistant:

    • servers: []
    • builtinTools: "none" (no shell, file or web tools; Claude only, as in fork: MCP profile builtinTools "none" (assistant PR 1) #927)
    • t3Tools: orchestration, threads, projects, plus the tools every profile keeps.
    • It sits next to all and t3-only in the one built-in table in contracts. The web list of built-ins now reads that table instead of keeping its own copy.
  • Settings → Fork → Assistant: a switch, then a row with Make assistant. The button makes two settings saves from the person at the screen:

    1. saves mcpThreadProfiles[id] = "assistant" for a new thread id, before the thread exists;
    2. makes a thread "Assistant" with that id in the Scratch project, with Claude's default model;
    3. saves threadRoles.assistant = id;
    4. opens the thread.

    Because the pick comes first, a thread called "Assistant" never runs with a wider profile, even if setup stops half-way. The role goes through the existing threadRoles server guard (thread exists, top-level, own project; person-only key). No agent path writes a role or a profile pick. If the run stops after the pick, the new thread is deleted while it is still empty (onlyIfUnused) and, once the client sees it gone, its pick is removed. The button stays busy until the run ends (it always ends, also when a step throws), and a ref stops a double click. The row is locked when a managed policy owns threadRoles or mcpThreadProfiles, and it shows whether the assistant thread is active or not.

  • The assistant thread never runs wider than assistant (resolver, so server turn check, launch and the web menu all agree): whatever its pick, the threadRoles.assistant thread gets at most the built-in assistant. A narrower pick stands; anything wider is cut to assistant.

  • Docs: new docs/fork/assistant.md, including exactly what the three T3 tool groups allow today (see "Fix round" below). In docs/fork/README.md: a table row and section for server.assistant, and the built-ins text now lists three. A FORK_CHANGES.md line.

Owner answers used (#153–#158, all yes): the assistant may start work without a tap (#158), so it runs full-access with no built-in tools.

Size

The plan said at most 400 changed lines. This PR is 585+ / 20−: 361 code, 130 test, 94 docs. I did not split it. Without its tests and docs it is under 400, and none of the parts is useful on its own: the setting, the profile and the button only make sense together. #927 grew the same way (531+ against a plan of 250).

Upstream fit

  • No upstream file changes. The seam check is 0. The Settings section mounts in the fork's own ForkSettingsPanel.
  • No Scratch or sidebar button: that would need new upstream lines. The button lives in the fork's Settings and uses upstream's own pieces: useScratchProject, threadEnvironment.create/delete, waitForThreadShell and the settings save.
  • The profile and role use mechanisms that are already merged (the MCP profile resolver, threadRoles), with no new server path.

General vs project

All general. There are no project names, paths or facts. The profile is a general least-privilege set; any thread can pick it. Which provider and model to use comes from the environment's providers.

State question

  • Assistant made twice: the second press makes a new thread and moves threadRoles.assistant to it. The old thread keeps its assistant pick and is not touched. Nothing is lost. A double click makes one thread, because a ref guards the run and the button stays busy until the saves settle.
  • Its thread archived or deleted: the client's thread list holds active threads only, so Settings says it is "archived, deleted or not on this server", and readers treat it as no assistant (the threadRoles rule). The pointer and pick stay until the next Make assistant replaces the pointer.
  • Profile edited by hand, or an own profile called assistant saved before this version: the entry makes the built-in "broken", so every thread that picks it is refused (fail closed) until it is removed. This uses the same rule as all and t3-only, and the test is extended to cover assistant. The docs carry an upgrade note: rename your own profile and move its picks first, because after removal those picks get the built-in.
  • Settings unreadable: assistant is read leniently: anything but enabled: true is off, and other settings are kept (tested). A bad threadRoles reads as no roles (Calm sidebar part 1: threadRoles and calmSidebarEnabled settings #928). A thread whose profile cannot be read is refused, never widened.
  • Stops half-way: after the pick only, nothing is made; a pick for a thread that does not exist does nothing. After the thread is made but before the role, an "Assistant" thread is left in Scratch that already has the narrow assistant profile and no role; Settings still says there is no assistant. If the run stops after the pick (thread not made, not seen, role refused, or an error), the empty thread is deleted and, once this client sees it gone, its pick is removed. A thread that stays (someone wrote in it, or the delete did not go through) keeps its narrow pick.
  • An older client: it has no Assistant section. It shows the thread's pick as a profile it does not know, and it cannot change assistant.
  • An older server with a newer client: the first save (the pick naming assistant) is refused as an unknown profile, nothing is made, and nothing is widened.

Known limits (later PRs)

  • The assistant cannot yet launch a thread into a project whose profile is wider than its own, because the launch check refuses that. It can message threads there. This is documented in docs/fork/assistant.md and left for PR 3.
  • The thread gets Claude's default model, with no model pin. The model policy turn check still applies.

Tests (each fails without the change)

I ran the new and changed tests against origin/main's source files with this PR's tests in place:

  • packages/contracts/src/assistant.test.ts: 2 fail (no assistant key).
  • packages/shared/src/forkSettingsPatch.test.ts "takes a pick of the assistant's built-in": fails (the pick is refused as unknown).
  • packages/shared/src/forkDocs.test.ts: 3 fail (README row and section with no setting).
  • .github/scripts/fork-changes-list.test.cjs: fails with the first version of the FORK_CHANGES.md row (no server.assistant named), and passes now.
  • apps/server/src/fork/mcpProfile.test.ts: 2 fail. A hand-written assistant entry is accepted, and the built-in is "not set up".
  • apps/server/src/golive/forkReport.test.ts: 1 fails.
  • apps/web/.../assistantSetup.logic.test.ts: fails (the module is missing). It checks that the pick save passes the save check before the thread exists, that the pick alone already resolves to builtinTools: "none", and then the role save. mcpProfileSettings.logic.test.ts: 2 fail (only two built-ins; assistant can be saved as a custom profile).

The tests use real behaviour: the patch goes through applyServerSettingsPatch and forkSettingsWriteProblem, and its pick through the real resolver. No mocks.

Checks run

  • Typecheck: contracts, shared, server and web all pass.
  • Vitest: contracts 85, shared 109, server 493, web unit 72 and browser McpProfileSettings 9, all passing.
  • .github/scripts/*.test.cjs: 368 passing.
  • Lint passes, and knip passes in pre-commit.
  • vp fmt --check on the touched files passes.
  • node .github/scripts/fork-seam-check.cjs --config-ref origin/main origin/main HEAD returns 0.

Fix round (code lens report on b1a7658)

  1. CI blocker, React Compiler (reactCompilerCoverage.test.ts): AssistantSettings.tsx used try/finally without catch, which the compiler does not compile. The run now lives in makeAssistantThread (logic file, plain try/catch), and the component runs it as a promise chain: .then(...) shows the error or opens the thread, .finally(...) clears busy. No try in the component.
  2. CI blocker, menu test (threadMcpProfile.logic.test.ts): kept assistant in every thread's menu and updated the test. Why: picking assistant only narrows a thread (no shell, files, web or outside servers); it never widens and gives no role. What makes a thread the assistant is threadRoles.assistant, which only Settings' person-only save sets. The design calls it a general least-privilege built-in, listed next to all and t3-only from one table. A non-Claude thread that picks it is refused with a reason (fail closed). With fix 4, the assistant thread itself cannot be widened from the menu either.
  3. Settings text and docs say plainly what the groups allow today. The Settings switch row now says the profile has no shell, files, web or outside servers, but its T3 tools do more than read, start and message threads, and the thread uses them without asking: change another thread's model and settings, interrupt threads, stop workflows, link and unlink environments, create projects, clone a repository onto disk, and delete projects (a forced delete also deletes all of that project's threads, archived ones too). docs/fork/assistant.md lists the tools per group; t3_thread_launch is now under projects (it was wrongly under threads). Both point at owner question Owner question: may the assistant delete projects and change other threads? (split tool groups) #954 (splitting the groups). The groups are not changed in this PR.
  4. Managed policy drops the assistant's pick → fail closed. The resolver holds the threadRoles.assistant thread within the built-in assistant: a result within it stands, a wider one (no pick, so the project or server default; or a wider pick) is cut to assistant with source assistant-role ("the assistant thread's limit" in Settings), its children are cut too, and a broken assistant built-in refuses the thread. The server's text and kept-keys read paths now carry threadRoles as an MCP profile key, so a settings file that does not fully decode still knows which thread is the assistant. Limit: a policy that owns threadRoles and drops the pointer makes the thread ordinary again (documented).
  5. Button busy forever if a save throws: makeAssistantThread never rejects; any step that throws or rejects ends the run with an error, and the component clears busy in .finally. (A persistServer that throws already reaches onFailed through Promise.allSettled in upstream's useScopedSettings; a synchronous throw now rejects the save promise, which the run catches. useScopedSettings is upstream and not touched.)
  6. Unused picks after refused or retried runs: any stop after the pick (thread not made, not seen by this client, role refused, or a throw) deletes the thread with onlyIfUnused, waits until this client sees it gone (5 s), and only then removes its pick (mcpThreadProfiles[id] = null). A refused pick save cleans up nothing (nothing was saved). A thread that stays keeps its narrow pick, because removing it would give the thread the wide defaults. Because onlyIfUnused returns success without deleting a used thread, the pick is removed only once the thread is really gone.
  7. Older build saving drops newer assistant fields: not fixable in this PR (an old build only knows { enabled }). Documented in docs/fork/assistant.md; today enabled is the only field, so nothing is lost, and a later PR that adds a field must read a missing field as its default.

Each fix fails without it

  • Fix 1 and 2: the CI failures on b1a7658 (reactCompilerCoverage.test.ts:32, threadMcpProfile.logic.test.ts:119); both pass now.
  • Fix 4, resolver returning the plain resolution (old behaviour): mcpProfile.test.ts 2 fail ("a managed policy that drops its pick…", "refuses, never widens…"). mcpProfileSettingsText.ts from b1a7658: 1 fails ("a file that does not decode still gives threadRoles.assistant…").
  • Fix 5, makeAssistantThread without its catch: 2 fail ("always ends with an outcome when a step throws or rejects…", and the clean-up after a throw).
  • Fix 6, without the clean-up call: 2 fail ("a refused role removes the empty thread, then its pick…", "each stop after the pick cleans up…").

The run tests use fake steps that log what they did; the patches themselves go through the real applyServerSettingsPatch, and the resolver tests use the real resolver.

Checks run on this round

  • Every web, server, contracts and shared test file that mentions profiles, mcpThreadProfiles, assistant or reactCompilerCoverage (216 files): contracts 4 files/56, shared 13/398, web unit 39/934 plus reactCompilerCoverage and the touched logic tests (1522), web browser McpProfileSettings 9/9. Server: 137 of 141 files pass; the 4 others fail on this machine only and not because of this PR (the local Node lacks Uint8Array.fromBase64 and StatementSync.stat, and AgentSessionScanner hooks time out under load). The other 19 browser files froze locally under load; PR CI runs them.
  • Typecheck (all packages), lint, vp fmt --check, seam check (0 upstream files beyond the pinned seams): pass.

State question (this round)

  • Runs again: each press makes a new thread; a stopped run leaves no pick behind once its thread is gone; the role cut is computed on every read, so nothing is stored for it.
  • Stops half-way: a stop between the delete and the pick removal leaves a pick for a thread that does not exist, which does nothing.
  • Old or empty state: no threadRoles or a bad one reads as no assistant and the cut does not apply; a settings file that does not decode still gives the pointer, so the cut still applies.

Review

One Opus lens (high effort, read-only, asked the state question). It found:

  • Blocking, fixed: the FORK_CHANGES.md row had one cell, not five, and did not name server.assistant.
  • Minor, fixed:
    • Archived and deleted threads now show as one state.
    • The button stays busy until the saves settle.
    • The pick is saved first, so there is no wide half-made thread.
    • The row also locks on mcpThreadProfiles.
    • The docs now cover an own profile called assistant and what the tool groups can do.
  • Owner-facing note (not changed): the projects and threads groups give the assistant more than starting and messaging work: it can delete or clone projects and configure other threads. This PR documents it; a finer split of the groups is a later decision.

🤖 Generated with Claude Code

scuttletoby and others added 3 commits November 22, 2026 12:05
…tant)

The switch assistant.enabled (off by default) offers "Make assistant" in
Settings. It makes a thread in the Scratch project and names it the
assistant in one person-path settings save: threadRoles.assistant (the
server's role guard decides) and the thread's MCP profile pick
"assistant". The new built-in profile "assistant" has no outside
servers, no built-in tools (builtinTools "none", Claude only) and the
T3 groups orchestration, threads and projects. The web list of
built-ins now reads the one table in contracts.

Assistant PR 2 of 18. Docs: docs/fork/assistant.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- FORK_CHANGES row: all five cells, naming server.assistant (the
  fork-changes-list test failed without it).
- Make assistant saves the profile pick before it makes the thread, so a
  setup that stops half-way never leaves a wider "Assistant" thread; the
  role is a second save once the thread exists.
- The button stays busy until the saves settle; a ref stops a double
  click from making two threads.
- An archived assistant reads as not active (the client's thread list
  holds active threads only), not as deleted.
- The button row is locked when a policy owns mcpThreadProfiles.
- Docs: what the three T3 tool groups can do, the upgrade note for an
  own profile called "assistant", and the half-way states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent (Opus, read-only) · read at: b1a7658
verdict: not safe to merge
covered: the full diff (20 files), the MCP profile resolver and launch check (launchMcpProfile.ts, scheduledTaskMcpProfile.ts), the orchestrator, thread and project toolkits the profile keeps, ProjectService delete, the person-only key list, the managed-policy whole-only list, useScopedSettings, the assistant design (section 5 and owner question 6) and the owner decisions on #153 to #158 and #879
checks: ran the 7 changed vitest files (276 tests pass): contracts assistant, shared forkSettingsPatch and forkDocs, server mcpProfile and forkReport, web assistantSetup.logic and mcpProfileSettings.logic; ran .github/scripts/fork-changes-list.test.cjs (10 pass); traced each way the "Assistant" thread could run with more than the profile: pick saved after start, retry, double click, two tabs, managed policy, a user profile named assistant, t3_thread_transfer fork, create_threads, t3_thread_launch, delegate_task, schedule_task, t3_thread_configure to another provider
state: runs again: each press makes a new thread and moves the pointer, the old thread keeps its narrow pick, nothing lost; stopped half-way: the pick is saved before the thread exists, so a half-made "Assistant" thread is never wider than the profile (a pick alone does nothing; a refused role save deletes the empty thread with onlyIfUnused); old settings without assistant read as off, threadRoles as no roles; a hand-written mcpProfiles.assistant makes the built-in refuse (fail closed); an older server refuses the first save, so nothing is made
blocker: none
major: the assistant profile's tool scope was never decided by the owner. The design (section 5) and #879 name the groups orchestration, threads and projects; #158 allows starting and messaging work without a tap. Nobody decided that the assistant may also, with no tap (the thread runs full-access): delete any project except Scratch with force: true, which deletes every thread of that project, archived ones too (ProjectService.ts:723-738; transcripts are lost); clone any repository onto disk and register or create folders (t3_project_clone, t3_project_create); change another thread's model (t3_thread_configure); interrupt threads and stop workflows; link and unlink environments. The design said starting work without a tap "is safe only with a yes on question 1" (cards only, no mail text); #153 answered the other way (the assistant may read mail text), so a hostile mail could later steer a thread that holds these tools. Single tools cannot be dropped today (profiles keep whole groups; dropping projects also drops t3_thread_launch). Needs an owner answer before merge: keep the three whole groups, or split projects (and threads) into read/start versus destructive tools before the assistant is offered (recommended: split before any mail PR lands).
minor: the Settings text says "no shell, files, web or outside servers; it can read, start and message threads" (AssistantSettings.tsx:144), but the profile can also delete projects with their threads, clone repositories from the network onto disk and reconfigure other threads; this is the text the owner reads when switching it on
minor: docs/fork/assistant.md puts "launch" under threads, but t3_thread_launch is in the project toolkit (group projects); and "delete them" should say a forced delete removes every thread of the project
minor: a managed policy that later owns mcpThreadProfiles (whole-only, forkManagedSettings.ts:15) without the assistant's id drops its pick, so the thread that still holds threadRoles.assistant resolves to the Scratch or server profile (by default all, with shell); the lock only stops a new Make assistant
minor: save() in AssistantSettings.tsx:78-81 waits for onSaved/onFailed, but useScopedSettings.ts:120 calls neither when writeScopedSettings rejects (a thrown persistServer error), so the button stays busy until the page remounts (nothing is made, so this is safe, only stuck)
minor: every refused or abandoned run leaves its mcpThreadProfiles pick for a thread id that never exists or was deleted; harmless, but entries pile up on retries
minor: AssistantSettingsFromSettingsFile encodes only enabled, so a downgrade that saves drops any field a newer build adds to assistant (other fork keys such as mcpProfiles keep entries as written)

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent (Opus, read-only), replaces my report above (it missed two CI failures) · read at: b1a7658
verdict: not safe to merge
covered: the full diff (20 files), the MCP profile resolver and launch check (launchMcpProfile.ts, scheduledTaskMcpProfile.ts), the orchestrator, thread and project toolkits the profile keeps, ProjectService delete, the person-only key list, the managed-policy whole-only list, useScopedSettings, the assistant design (section 5 and owner question 6) and the owner decisions on #153 to #158 and #879
checks: ran the 7 changed vitest files (276 tests pass): contracts assistant, shared forkSettingsPatch and forkDocs, server mcpProfile and forkReport, web assistantSetup.logic and mcpProfileSettings.logic; ran .github/scripts/fork-changes-list.test.cjs (10 pass); traced each way the "Assistant" thread could run with more than the profile: pick saved after start, retry, double click, two tabs, managed policy, a user profile named assistant, t3_thread_transfer fork, create_threads, t3_thread_launch, delegate_task, schedule_task, t3_thread_configure to another provider
state: runs again: each press makes a new thread and moves the pointer, the old thread keeps its narrow pick, nothing lost; stopped half-way: the pick is saved before the thread exists, so a half-made "Assistant" thread is never wider than the profile (a pick alone does nothing; a refused role save deletes the empty thread with onlyIfUnused); old settings without assistant read as off, threadRoles as no roles; a hand-written mcpProfiles.assistant makes the built-in refuse (fail closed); an older server refuses the first save, so nothing is made
blocker: CI is red on this head: Test Web 1 fails apps/web/src/reactCompilerCoverage.test.ts:32, because React Compiler refuses the try/finally without catch in makeAssistant (AssistantSettings.tsx:89), so the new component is not compiled; use try/catch/finally or move the steps into a helper the finally does not wrap
blocker: CI is red on this head: Test Web 3 fails apps/web/src/components/fork/mcpProfile/threadMcpProfile.logic.test.ts:119, which expects 5 profile picks in the thread menu and now gets 6 (mcp-profile:pick:assistant); the PR body's "web unit 72 passing" did not include this file. Update the test, and check that the new built-in in every thread's menu is wanted
major: the assistant profile's tool scope was never decided by the owner. The design (section 5) and #879 name the groups orchestration, threads and projects; #158 allows starting and messaging work without a tap. Nobody decided that the assistant may also, with no tap (the thread runs full-access): delete any project except Scratch with force: true, which deletes every thread of that project, archived ones too (ProjectService.ts:723-738; transcripts are lost); clone any repository onto disk and register or create folders (t3_project_clone, t3_project_create); change another thread's model (t3_thread_configure); interrupt threads and stop workflows; link and unlink environments. The design said starting work without a tap "is safe only with a yes on question 1" (cards only, no mail text); #153 answered the other way (the assistant may read mail text), so a hostile mail could later steer a thread that holds these tools. Single tools cannot be dropped today (profiles keep whole groups; dropping projects also drops t3_thread_launch). Needs an owner answer before merge: keep the three whole groups, or split projects (and threads) into read/start versus destructive tools before the assistant is offered (recommended: split before any mail PR lands).
minor: the Settings text says "no shell, files, web or outside servers; it can read, start and message threads" (AssistantSettings.tsx:144), but the profile can also delete projects with their threads, clone repositories from the network onto disk and reconfigure other threads; this is the text the owner reads when switching it on
minor: docs/fork/assistant.md puts "launch" under threads, but t3_thread_launch is in the project toolkit (group projects); and "delete them" should say a forced delete removes every thread of the project
minor: a managed policy that later owns mcpThreadProfiles (whole-only, forkManagedSettings.ts:15) without the assistant's id drops its pick, so the thread that still holds threadRoles.assistant resolves to the Scratch or server profile (by default all, with shell); the lock only stops a new Make assistant
minor: save() in AssistantSettings.tsx:78-81 waits for onSaved/onFailed, but useScopedSettings.ts:120 calls neither when writeScopedSettings rejects (a thrown persistServer error), so the button stays busy until the page remounts (nothing is made, so this is safe, only stuck)
minor: every refused or abandoned run leaves its mcpThreadProfiles pick for a thread id that never exists or was deleted; harmless, but entries pile up on retries
minor: AssistantSettingsFromSettingsFile encodes only enabled, so a downgrade that saves drops any field a newer build adds to assistant (other fork keys such as mcpProfiles keep entries as written)

scuttletoby and others added 3 commits November 22, 2026 12:49
…d runs, plain tool-group text (#953)

- React Compiler: Make assistant runs as a promise chain with no try/finally;
  makeAssistantThread never rejects, so the button always leaves busy.
- The built-in `assistant` stays in every thread's profile menu (it only
  narrows and gives no role); the menu test lists it.
- Resolver: the threadRoles.assistant thread never runs wider than the
  built-in `assistant`, even when a managed policy drops its pick; the
  pointer is read on the text and kept-keys paths too.
- A run that stops after the pick deletes its empty thread and, once the
  client sees it gone, removes the pick.
- Settings text and docs say plainly what the three tool groups allow
  (forced project delete, clone, configure, interrupt, workflows,
  environments), move launch under projects, point at owner question #954,
  and note how an older build saves `assistant`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code r2 · reviewer: lens agent (Opus, read-only) · read at: c324947
verdict: safe to merge
covered: the full diff since round 1 (24 files); the resolver cap resolveAt (packages/contracts/src/mcpProfileResolve.ts:447) and the built-in table (:130); the server's profile read path (claudeMcpProfile.ts makeMcpProfileSettings, managed locks laid over the file's keys, mcpProfileSettingsText.ts now carrying threadRoles); the launch checks on t3_thread_launch, create_threads and delegate_task (delegateChecks.ts), t3_thread_transfer fork, schedule_task and run-now; makeAssistantThread and AssistantSettings.tsx; the orchestrator, thread and project toolkits against docs/fork/assistant.md; the owner decision on #954 (split the groups; the assistant acts only on the owner's instructions)
checks: ran the changed test files: contracts assistant.test.ts (2), shared forkSettingsPatch and forkDocs (104), server mcpProfile.test.ts and mcpProfileSettingsText.test.ts pass, web assistantSetup.logic, mcpProfileSettings.logic and threadMcpProfile.logic (33), .github/scripts/fork-changes-list.test.cjs (10). Not runnable here: apps/server/src/golive/forkReport.test.ts "exits 0 only when the running server says it is quiet" needs a loopback socket (reads unreachable here); this PR only adds one key line to that file, and PR CI runs it (green). Made each fix fail: with the cap removed from resolveAt, 2 tests fail in mcpProfile.test.ts; without the discardUnused call, 2 fail; without the catch in makeAssistantThread, 2 fail. Seam check returns 0. CI on this head is green, fork-ci-result pass; main is one commit ahead (#962, unrelated files)
state: runs again: each press makes a new thread and moves the pointer; the old thread keeps its narrow pick; the cap is computed on every read, nothing stored. Stopped half-way: the pick is saved before the thread exists, so a thread named "Assistant" is never wider; a stop after the pick deletes the empty thread (onlyIfUnused) and removes the pick only once this client sees it gone; a used thread keeps its narrow pick. Old or empty state: no or bad assistant reads as off, no or bad threadRoles as no assistant (no cap, nothing to cap); a settings file that does not decode still yields the pointer from its text; a hand-written mcpProfiles.assistant refuses the assistant thread (fail closed)
safe to merge first: yes. assistant.enabled is off by default and only shows the button. Nothing reaches the broad groups through this PR: the assistant profile is strictly narrower than all and t3-only (no servers, no built-in tools, 3 groups), so picking it only narrows; threadRoles.assistant grants nothing and only caps; both keys are person-only (FORK_AGENT_WRITABLE_KEYS is empty). Each way a thread could get more than its profile goes through the capped resolver: children of the assistant are cut to its capped profile, launch, fork, create_threads and scheduled runs are refused when the new thread would be wider, and a carried profile is the capped one. The split stays easy: the built-in is defined in code and a pick stores only its name, so the split's new group list applies to existing assistant threads with no migration
round 1, fixed: React Compiler try/finally (the run moved to the logic file, the component uses .then/.finally; CI Test Web 1 green)
round 1, fixed: the thread menu test now expects the assistant pick (Test Web 3 green); keeping it in every menu is fine because it only narrows
round 1, fixed: a managed policy that drops the pick no longer widens the assistant thread: the resolver caps the threadRoles.assistant thread to the built-in, a broken built-in refuses it, and the text read path keeps the pointer
round 1, fixed: the button leaves busy on every path (makeAssistantThread never rejects; the scoped writer settles through Promise.allSettled)
round 1, fixed: stopped runs remove their pick once the thread is gone
round 1, fixed: Settings text and docs now name what the three groups allow, and t3_thread_launch sits under projects
blocker: none
major: none
follow-up:
minor: the docs still call the split "an open owner question" (docs/fork/assistant.md:51) and the Settings text points at #954 as open (AssistantSettings.tsx:147); the owner has decided (split, read/start/message only). The split PR should rewrite both
minor: for the split PR: a scheduled task the assistant saves records its resolved group list, not the name assistant (scheduledTaskMcpProfile.ts:414, carryMcpProfile), and so does a carried profile; if the split adds new narrow groups and keeps threads/projects whole, such a task made before the split keeps the destructive tools. Either narrow the old names or say how old records read
minor: the owner's second rule (the assistant takes permission only from the owner, never from what it reads) is not in this PR; today the assistant can t3_thread_read other threads' transcripts (which may quote web pages) and then use the destructive tools. That is no wider than any all thread today, but the rule should land with the split, before any mail PR
minor: the docs' group lists leave out a few tools: orchestrator_capabilities, task_status, t3_background_wait and t3_environment_links (orchestration), t3_submit_output (threads); none of them is destructive

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state r2 · reviewer: lens agent (Opus, read-only) · read at: c324947
verdict: safe to merge
covered: the full diff (24 files) at this head; the PR body and its fix round; the round-1 code lens report; #879; owner question #954 and its owner decision (split the groups; the assistant acts only on the owner's own instructions); the resolver (resolveAt/resolveOwnAt, cutTo, isWithinMcpProfile), the server profile path (claudeMcpProfile.ts lineage read, plan key, mcpT3ToolSets per-call filter, launchMcpProfile.ts), mcpProfileSettingsText.ts, the person-only key list (FORK_AGENT_WRITABLE_KEYS is empty), the mcpProfiles patch check on built-in names, the thread.delete onlyIfUnused path in Orchestrator.ts, useUpdateScopedSettings, docs/fork/assistant.md and the README sections
checks: ran the changed test files: contracts assistant.test.ts 2/2, shared forkSettingsPatch.test.ts + forkDocs.test.ts 104/104, server mcpProfile.test.ts + mcpProfileSettingsText.test.ts + golive/forkReport.test.ts 168/169, web threadMcpProfile.logic, assistantSetup.logic, mcpProfileSettings.logic 33/33, .github/scripts/fork-changes-list.test.cjs 10/10. The one failure, forkReport.test.ts "exits 0 only when the running server says it is quiet", is a socket test (a loopback HTTP probe), which cannot run on the lens machine because loopback is blocked; this PR changes only one reason string in that file. Mutations, each reverted: the role cut switched off in resolveAt turns 2 mcpProfile.test.ts tests red; the pick removal made unconditional in discardUnused turns "a thread that stays ... keeps its narrow pick" red; threadRoles dropped from the text read's ServerKeys turns "a file that does not decode still gives threadRoles.assistant" red.
state: off by default: assistant reads as {enabled:false} for a missing or bad value, and off only hides the button. No thread, pick or role exists until the person presses Make assistant. Nothing reaches the assistant role or its profile without a person-only save: threadRoles, mcpThreadProfiles and assistant are person-only (no agent-writable fork key), mcpProfiles refuses a non-null entry under a built-in name, and the role only narrows (resolveAt cuts the role thread to assistant; every server path, including the turn check, the launch check, scheduled tasks, carried profiles for linked machines and the per-call T3 tool filter, goes through that one resolver, and a changed profile changes the plan key, so the next turn starts a fresh, narrower process). Runs again: each press makes a new thread with its own pick, and the old thread keeps its assistant pick when the pointer moves, so it never widens. Stops half-way: the pick is saved before the thread exists; a refused pick save cleans up nothing; a stop after it deletes the thread with onlyIfUnused (checked under the thread lock on the server) and removes the pick only once this client sees no thread; a thrown step still ends the run and clears busy. A thread someone already wrote in is never deleted, and keeps its pick in the normal path (see minor 1 for one exception). Managed policy: dropping the pick is cut back to assistant by the role (tested). Dropping the threadRoles pointer too makes the thread ordinary; this is documented, and the admin owns both keys. A broken assistant profile (a hand-written mcpProfiles.assistant, or an own profile of that name from before this version) refuses every thread that picks it and the role thread (fail closed, tested). Older builds: an older server does not know the pick assistant and refuses it as missing, so nothing is widened; a newer client on an older server is refused at the first save; a build that knows assistant as {enabled} only drops future fields when it saves (documented; nothing is lost today). Later split: the profile is a built-in defined in code and picks store only the name assistant, so the split PR changes MCP_BUILT_IN_PROFILES once, and every assistant thread and its children narrow on their next turn. Nothing here makes the split harder; only the Settings text and the docs need rewording.
blocker: none
major: none
minor: follow-up: when Make assistant stops because the new thread "did not reach this client", discardThread (AssistantSettings.tsx:122-124) counts as gone a thread this client never saw (waitForThreadShellGone is true at once), while thread.delete with onlyIfUnused succeeds without deleting a used thread (Orchestrator.ts:15702-15712). So if someone wrote in the new thread from another client within those seconds, its pick is removed (assistantSetup.logic.ts:126) and the "Assistant" thread runs the defaults. It never had the role, so this widens nothing beyond a thread the person made, but docs/fork/assistant.md ("a thread that stays ... keeps its narrow pick") is not true in this case. Fix: remove the pick only when the delete produced events, or after this client once saw the thread.
minor: follow-up: the Settings text (AssistantSettings.tsx:147) and docs/fork/assistant.md:50-53 still call the split an open owner question on #954. The owner has decided: split, the assistant gets only read, start and message, and it acts only on the owner's own instructions, never on what it reads. Until the split PR lands, the assistant keeps the destructive tools (force-deleting projects with their threads, cloning, t3_thread_configure, unlinking environments), and nothing yet stops instructions it reads in another thread's transcript. That is no wider than an ordinary all thread, but the split and the "acts only on owner instructions" rule should land, as planned, before any PR adds what it reads. The split PR should reword this text.
minor: follow-up: docs/fork/README.md:1162 (server.threadRoles) still says the default "changes nothing" and that the setting "alone shows nothing", and the reason in forkReport.test.ts:1129 says "nothing reads them yet". The MCP resolver now reads threadRoles.assistant to hold that thread within assistant. A person who edits the pointer by hand should find that in the threadRoles section.
minor: follow-up: a managed policy that owns both threadRoles and mcpThreadProfiles and drops both entries gives the former assistant thread the defaults (all, with shell) together with its whole transcript. This is documented and harmless while the assistant reads no outside content, but once mail lands the later PRs should keep such a thread narrow (for example, by refusing a thread that holds the assistant pick only by policy loss).

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

Both round-2 lenses: safe to merge. The minors are in follow-up #980 (most go into the tool-split PR). Queued for merge after #958.

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit cac09fe into main Nov 22, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant